package com.atguigu.juc.interview.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author leimingchao
 * @create 2021-04-21 19:38
 */
public class CASTest {
    public static void main(String[] args) {
        AtomicInteger atomicInteger=new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2019)+"\t current data: "+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 1024)+"\t current data: "+atomicInteger.get());
        atomicInteger.getAndIncrement();
    }
}
